The shuttle puzzle - A lesson in problem solving

نویسنده

  • John S. Gray
چکیده

Beginning computer science students often have great difficulty with the analysis and design of solutions to programming related problems. Using the Shuttle Puzzle problem as a vehicle the process of analyzing a problem and synthesizing observations into an algorithm is presented in a detailed, step-by-step manner. Introduction When I was child and went to visit my grandparents, I would often entertain myself with one of a variety of puzzles that magically populated their bookcase. One of the puzzles that I frequently tried, but could never master, was a homemade puzzle consisting of a strip of wood with nine holes. Placed on opposite ends of the strip were marbles of the same color, the center hole was left empty. The object of the puzzle was to reverse the marbles using one of two permissible moves. A marble could slide forward into an empty space, or a marble could jump another marble of the opposite color providing the new location was empty and the jump was in a forward direction. Invariably after making four or five moves I would arrive at a dead end, most often with a marble trapped on one end surrounded by a sea of marbles of the opposite color. With practiced hands my grandfather would rearrange the marbles to their starting locations and swiftly execute a sequence of moves to solve the puzzle. Much later in life, while teaching Computer Science classes at the University of Hartford, I ran into the same puzzle again both as a programming exercise and as a qualifying problem in a computing contest competition (USA Computing Olympiad, 1993). The puzzle, called a Shuttle Puzzle, can be formally described as: A Shuttle Puzzle of size 4 consists of 4 white marbles, 4 black marbles, and a strip of wood with 9 holes (as shown below). The marbles of the same color are placed in the holes at the opposite ends of the strip leaving the center hole empty. The object of the puzzle is to completely reverse the marbles on the strip. In general, a shuttle puzzle of size N consists of N white marbles, N black marbles and 2N+1 holes. There are only two permissible types of moves. You may slide 1 marble 1 space (into an empty hole) or jump 1 marble over 1 marble of the opposite color (into an empty hole). You may not backup, and you may not jump 2 (or more) marbles at once. Write a program that solves the Shuttle Puzzle for sizes 1 <= N <= 10. Remembering my earlier frustrations at attempting a solution, I approached the problem with renewed interest. In generating a solution I found that the Shuttle Puzzle offers an excellent opportunity to teach beginning Computer Science students the rudiments of how

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

The Effect of Story-based, L1 Translation, and Whatsapp Emoticon Puzzle-Solving Techniques on Iranian Intermediate EFL Learners’ Proverb Learning

This study investigated the effect of story-based technique, L1 translation, and Whatsapp emoticon puzzle solving on EFL learners’ learning proverbs. From among 90 female intermediate level learners at two language institutes in Qom, Iran, 60 homogeneous students were chosen following the administration of a sample of Nelson proficiency test and a pre-test. The 60 participants were then assigne...

متن کامل

Comparison of Lecture and Puzzle for Teaching Medical Emergency to Anesthesiology Students: Students’ Learning and Viewpoints

Introduction: Emphasis on active learning in training leads to the development of new educational strategies for teaching theoretical and clinical courses in medical sciences. Active involvement in the teaching-learning process improves learning. The purpose of the present study is to compare two methods of lecturing and puzzle in Medical Emergency Course, regarding students’ learning & viewpoi...

متن کامل

Naturalizing Self-Consciousness

The crucial problem of self-consciousness is how to account for knowing self-reference without launching into a regress or without presupposing self-consciousness rather than accounting for it (circle). In the literature we find two bottom-up proposals for solving the traditional problem: the postulation of nonconceptual forms of self-consciousness and the postulation of a pre-reflexive form of...

متن کامل

The Role of Unbalanced Balance Sheet of Banking System in Creating the Puzzle of Interest Rate, Inflation and Liquidity Growth: Evidence from Iran

The analysis of macroeconomic variables for current situation in Iran indicates a Conundrum. Solving this puzzle is vital for Central Bank of Iran in order to choose an appropriate approach for monetary policy and banking supervision. Increase in liquidity growth rate, significant decrease of inflation rate and interest rate rigidity are the three sides of this puzzle. This study designs an inn...

متن کامل

A study of elementary school teachers' challenges of encountering with Lesson Study

This research aimed to study the challenges which elementary teachers deal with lesson study. This research studied challenges in three stages, before, during and after lesson study. To achieve the aim of the research, a case study in a school was used. Participants of this research have been 20 elementary teacher of that school. Data collection tools have been semi-structured interviews with t...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:
  • J. Computing in Higher Education

دوره 10  شماره 

صفحات  -

تاریخ انتشار 1998